package com.hyx.api.controller.pc_admin;

import java.util.List;

import org.springframework.security.access.prepost.PreAuthorize;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.hyx.api.domain.bo.InquiryOrderBo;
import com.hyx.api.domain.vo.InquiryOrderVo;
import com.hyx.api.service.pc_admin.IInquiryOrderService;

/**
 * 询价订单Controller
 *
 * @author HK
 * @date 2023-10-28
 */
@RequiredArgsConstructor
@RestController
@RequestMapping("/order/inquiry")
public class InquiryOrderController extends BaseController {
    private final IInquiryOrderService inquiryOrderService;

    /**
     * 查询询价订单列表
     */
    @PreAuthorize("@ss.hasPermi('order:inquiry:list')")
    @GetMapping("/list")
    public TableDataInfo list(InquiryOrderBo bo) {
        startPage();
        List<InquiryOrderVo> list = inquiryOrderService.selectInquiryOrderList(bo);
        return getDataTable(list);
    }

    /**
     * 获取询价订单详细信息
     */
    @PreAuthorize("@ss.hasPermi('order:inquiry:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return success(inquiryOrderService.selectInquiryOrderById(id));
    }

    /**
     * 获取询价订单详情
     *
     * @param id
     * @return
     */
    @GetMapping("/queryInquiryOrderDetail")
    public AjaxResult queryInquiryOrderDetail(@RequestParam Long id) {
        return AjaxResult.success(inquiryOrderService.queryInquiryOrderDetailById(id, null));
    }

}
